﻿
@{
    ViewBag.Title = "ListContent";
    Layout = null;
}

@using Utils.Types
@model List<Model.Content.Article>

<head>
    <title>@ViewBag.Title</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="/Scripts/ArtTemplate/template.js"></script>
    <link href="/Scripts/AmazeUI/assets/css/amazeui.min.css" rel="stylesheet" />
    <link href="/Scripts/AmazeUI/assets/css/admin.css" rel="stylesheet" />
    <link href="/Scripts/AmazeUI/assets/css/app.css" rel="stylesheet" />

    <style type="text/css">
        .mainitem
        {
            float: left !important;
        }

        .am-selected
        {
            width: 60px;
        }

        li .am-selected-content
        {
            top: -250px;
        }
    </style>
</head>

@Html.AntiForgeryToken()

<div class="tpl-block" style="background-color: white">
    <div class="am-g">
        <div class="am-u-sm-12 am-u-md-6">
            <div class="am-btn-toolbar">
                <div class="am-btn-group am-btn-group-xs">
                    <button type="button" class="am-btn am-btn-default am-btn-success" id="addarticle"><span class="am-icon-plus"></span> 新增</button>
                    <button type="button" class="am-btn am-btn-default am-btn-danger" id="deleteall"><span class="am-icon-trash-o"></span> 删除</button>
                    <button type="button" class="am-btn am-btn-default am-btn-warning" id="selectall">全选</button>
                </div>
            </div>
        </div>
        <div class="am-u-sm-12 am-u-md-3">
            <div class="am-form-group" id="categorytypeselect">
                <select id="categorytype" data-am-selected="{btnSize: 'sm'}"></select>
            </div>
        </div>
        <div class="am-u-sm-12 am-u-md-3">
            <div class="am-input-group am-input-group-sm">
                <input type="text" class="am-form-field" id="searchtext">
                <span class="am-input-group-btn">
                    <button class="am-btn  am-btn-default am-btn-success tpl-am-btn-success am-icon-search" type="button" id="searchbtn"></button>
                </span>
            </div>
        </div>
    </div>

    <div class="am-g">
        <div class="tpl-table-images">
            <input type="hidden" id="pagerhidden" value="@ViewBag.Count" />
            <input type="hidden" id="pagerindex" value="1" />
            <div id="articlelist">
                @if (Model != null && Model.Count > 0)
                {
                    <div style="display: none">
                        @foreach (var item in Model)
                        {
                            <div class="am-u-sm-12 am-u-md-3 am-u-lg-2 mainitem">
                                <input type="hidden" value="@item.ArticleID" displaystatus="@item.IsShow" class="article_item" />
                                <div class="tpl-table-images-content">
                                    <div class="tpl-table-images-content-i-time">
                                        发布时间：@item.CreateTime.DateTimeToString()
                                        <input type="checkbox" name="articleselect" value="@item.ArticleID" style="float: right !important" />
                                    </div>
                                    <div class="tpl-i-title" style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis;">
                                        @item.Title
                                    </div>
                                    <a class="tpl-table-images-content-i itemimage">
                                        <span class="tpl-table-images-content-i-shadow"></span>
                                        <img src="@item.Images" alt="">
                                    </a>
                                    <div class="tpl-table-images-content-block">
                                        <div class="tpl-i-font">
                                            @Html.Raw(item.Details)
                                        </div>
                                        <div class="tpl-i-more">
                                            <ul>
                                                <li><span class="am-icon-qq am-text-warning"> @item.PageViewCount</span></li>
                                                <li><span class="am-icon-weixin am-text-success"> @item.PageViewCount</span></li>
                                                <li><span class="am-icon-github font-green"> @item.PageViewCount</span></li>
                                            </ul>
                                        </div>
                                        <div class="am-btn-toolbar">
                                            <div class="am-btn-group am-btn-group-xs tpl-edit-content-btn">
                                                <button type="button" class="am-btn am-btn-default am-btn-success article_display">@(item.IsShow == 1 ? "显示" : "隐藏")</button>
                                                <button type="button" class="am-btn am-btn-default am-btn-secondary article_edit">编辑</button>
                                                <button type="button" class="am-btn am-btn-default am-btn-warning article_top">置顶</button>
                                                <button type="button" class="am-btn am-btn-default am-btn-danger article_delete">删除</button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        }
                    </div>
                }
                else
                {
                    <div style="text-align: center; padding: 20px">没有数据！</div>
                }
            </div>
            <div class="am-u-lg-12">
                <div class="am-cf">
                    <div class="am-fr">
                        <ul class="am-pagination tpl-pagination" id="pager">
                            <li>
                                总数：<font style="color: red" id="pagecount">@ViewBag.Count</font>条，
                            </li> 
                            <li>
                                每页数量
                            </li>
                            <li>
                                <select data-am-selected id="pagenumber">
                                    <option value="2">2</option>
                                    <option value="5">5</option>
                                    <option value="10" selected>10</option>
                                    <option value="20">20</option>
                                    <option value="50">50</option>
                                    <option value="100">100</option>
                                </select>
                            </li>
                        </ul>
                    </div>
                </div>
                <hr>
            </div>
        </div>
    </div>
</div>

<script id="articletpl" type="text/html">
    <div class="am-u-sm-12 am-u-md-3 am-u-lg-2 mainitem">
        <input type="hidden" value="{{ArticleID}}" displaystatus="{{IsShow}}" class="article_item" />
        <div class="tpl-table-images-content">
            <div class="tpl-table-images-content-i-time">
                发布时间：{{CreateTime}}
                <input type="checkbox" name="articleselect" value="{{ArticleID}}" style="float: right !important" />
            </div>
            <div class="tpl-i-title" style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis;">
                {{Title}}
            </div>
            <a class="tpl-table-images-content-i itemimage">
                <span class="tpl-table-images-content-i-shadow"></span>
                <img src="{{Images}}" alt="">
            </a>
            <div class="tpl-table-images-content-block">
                <div class="tpl-i-font">
                    {{#Details}}
                </div>
                <div class="tpl-i-more">
                    <ul>
                        <li><span class="am-icon-qq am-text-warning">{{PageViewCount}}</span></li>
                        <li><span class="am-icon-weixin am-text-success">{{PageViewCount}}</span></li>
                        <li><span class="am-icon-github font-green">{{PageViewCount}}</span></li>
                    </ul>
                </div>
                <div class="am-btn-toolbar">
                    <div class="am-btn-group am-btn-group-xs tpl-edit-content-btn">
                        <button type="button" class="am-btn am-btn-default am-btn-success article_display">
                            {{if IsShow==1}}
                            显示
                            {{else}}
                            隐藏
                            {{/if}}
                        </button>
                        <button type="button" class="am-btn am-btn-default am-btn-secondary article_edit">编辑</button>
                        <button type="button" class="am-btn am-btn-default am-btn-warning article_top">置顶</button>
                        <button type="button" class="am-btn am-btn-default am-btn-danger article_delete">删除</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</script>

<script src="/Scripts/Jquery/jquery-1.12.4.js"></script>
<script src="/Scripts/AmazeUI/assets/js/amazeui.min.js"></script>
<script src="/Scripts/Util.js"></script>
<script src="/Areas/EasyUI/Scripts/Admin/ListContent.js"></script>
